//
//  YQCollectionVC.m
//  NewRetail
//
//  Created by yuqin on 2019/6/23.
//  Copyright © 2019年 yuqin. All rights reserved.
//

#import "YQCollectionVC.h"

@interface YQCollectionVC ()



@end

@implementation YQCollectionVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.txtTitle.text = @"收款";
    self.view.backgroundColor = MainBlueColor;
    [self setupCollectionView];
}

- (void)setupCollectionView {
    //懒得v写View
    UIView *backView = [[UIView alloc] init];
    backView.backgroundColor = WhiteColor;
    backView.layer.cornerRadius = 5;
    [self.view addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.centerY.mas_equalTo(self.view.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(ScreenWidth-FIT(40), ScreenHeight/2.0));
    }];
    CGFloat backView_W = ScreenWidth-FIT(40);
    
    UILabel *theTitleLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentCenter fontSize:FIT(20) userBold:NO];
    theTitleLab.text = @"收款码";
    [backView addSubview:theTitleLab];
    [theTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(FIT(20));
        make.centerX.mas_equalTo(backView.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(ScreenWidth, 20));
    }];
    
    UIImageView *codeImageView = [YQViewFactory imageViewWithImage:YQ_IMAGE(@"")];
    codeImageView.backgroundColor = MainRedTextColor;
    [backView addSubview:codeImageView];
    [codeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(theTitleLab.mas_bottom).mas_equalTo(FIT(20));
        make.centerX.mas_equalTo(backView.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(backView_W/2.0, backView_W/2.0));
    }];
    
    UILabel *coinTypeLab = [YQViewFactory labelWithTextColor:MainGrayColor textAlignment:NSTextAlignmentCenter fontSize:kTheTitleFont userBold:NO];
    //多字体
    coinTypeLab.text = @"币种   WDC";
    [backView addSubview:coinTypeLab];
    [coinTypeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(codeImageView.mas_bottom).mas_equalTo(FIT(30));
        make.centerX.mas_equalTo(backView.mas_centerX);
        make.size.mas_equalTo(CGSizeMake(backView_W, FIT(20)));
    }];
    
    UILabel *coinLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentCenter fontSize:FIT(13) userBold:NO];
    coinLab.text = @"0x6f2b3468979871khi238925975nkih234972jb325sdwe";
    coinLab.numberOfLines = 2;
    [backView addSubview:coinLab];
    [coinLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(FIT(30));
        make.top.equalTo(coinTypeLab.mas_bottom).mas_equalTo(FIT(20));
        make.size.mas_equalTo(CGSizeMake(backView_W-FIT(60), 40));
    }];
    
    //底部两个button
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = LineColor;
    [backView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.equalTo(coinLab.mas_bottom).mas_equalTo(FIT(15));
        make.size.mas_equalTo(CGSizeMake(backView_W, 1));
    }];
    
    //button的宽
    CGFloat button_W = backView_W/2.0-1;
    for (NSInteger i = 0; i < 2; i++) {
        UIButton *btn = [YQViewFactory buttonWithTitle:i == 0 ?@"保存图片":@"复制地址"
                                            titleColor:MainBlackColor fontSize:kNormalButtonFont userBold:NO target:self sel:@selector(selectAction:)];
        btn.tag = 100+i;
        [backView addSubview:btn];
        [btn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(button_W*i);
            make.bottom.mas_equalTo(0);
            make.top.equalTo(lineView.mas_bottom).mas_equalTo(1);
            make.width.mas_equalTo(button_W);
        }];
        if (i == 0) {
            UIView *view = [[UIView alloc] init];
            view.backgroundColor = LineColor;
            [backView addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(lineView.mas_bottom).mas_equalTo(FIT(5));
                make.bottom.mas_equalTo(-FIT(5));
                make.left.mas_equalTo(button_W);
                make.width.mas_equalTo(1);
            }];
        }
    }
}

- (void)selectAction:(UIButton *)sender {
    
}

@end
